from ..data_structures.base_structures import Map
from .factor_analyzer_components import *

class FactorAnalyzer:
    factor_analyzer_components = [

    ]

    def add_component(component:str):
        FactorAnalyzer.factor_analyzer_components.append(component)

    def analyse_factor(map:Map):
        for component in FactorAnalyzer.factor_analyzer_components:
            # 反射调用方法
            method_name = component
            method = getattr(FactorAnalyzerComponents, method_name, None)
            if method is None:
                raise AttributeError(f"未找到组件方法: {method_name}")
            # try:
            method(map)
            # except Exception as e:
            #     print(f"调用组件方法 {method_name} 时出错: {e}")
